import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AttrKeyVO, AttrKeyForm, AttrKeyDataQuery } from '@/api/apartment/attribute/attrKey/types';

/**
 * 查询房间基本属性列表
 * @param query
 * @returns {*}
 */

export const listAttrKey = (query?: AttrKeyDataQuery): AxiosPromise<AttrKeyVO[]> => {
  return request({
    url: '/apartment/attrKey/getAllList',
    method: 'post',
    data: query
  });
};

/**
 * 查询房间基本属性详细
 * @param id
 */
export const getAttrKey = (id: string | number): AxiosPromise<AttrKeyVO> => {
  return request({
    url: '/apartment/attrKey/' + id,
    method: 'get'
  });
};

/**
 * 新增房间基本属性
 * @param data
 */
export const addAttrKey = (data: AttrKeyForm) => {
  return request({
    url: '/apartment/attrKey',
    method: 'post',
    data: data
  });
};

/**
 * 修改房间基本属性
 * @param data
 */
export const updateAttrKey = (data: AttrKeyForm) => {
  return request({
    url: '/apartment/attrKey',
    method: 'put',
    data: data
  });
};

/**
 * 删除房间基本属性
 * @param id
 */
export const delAttrKey = (id: string | number | Array<string | number>) => {
  return request({
    url: '/apartment/attrKey/' + id,
    method: 'delete'
  });
};
